// 产品类
public class Computer {
    private String cpu;     // 必选
    private String ram;     // 必选
    private String hdd;     // 可选
    private String gpu;     // 可选

    public Computer(String cpu, String ram) {
        this.cpu = cpu;
        this.ram = ram;
    }

    // 可选组件的 setter 方法
    public void setHdd(String hdd) { this.hdd = hdd; }
    public void setGpu(String gpu) { this.gpu = gpu; }

    public void setCpu(String cpu) { this.cpu = cpu; }
    public void setRam(String ram) { this.ram = ram; }

    @Override
    public String toString() {
        return "Computer [CPU=" + cpu + ", RAM=" + ram + ", HDD=" + hdd + ", GPU=" + gpu + "]";
    }

}
